package com.company.service.impl;

import com.company.service.BaseService;
import com.company.service.StartService;
import com.company.utils.ServicrFatory;

import java.util.Scanner;

public class StartServiceImpl implements StartService {
    @Override
    public void execute() {
        Scanner input = new Scanner(System.in);
        System.out.println("******欢迎使用”裹裹快投”快递服务软件******");
        while (true) {
            System.out.println("1.我要寄件 2.查询订单 3.修改订单 4.取消订单 5.查询常用联系人 6.退出系统");
            System.out.println("请选择（1~6），");
            switch (input.nextInt()) {
                case 1:
                    BaseService baseService1= ServicrFatory.getService("jijian");
                    baseService1.execute();
                    continue;
                case 2:
                    BaseService baseService2= ServicrFatory.getService("chaxun");
                    baseService2.execute();
                    continue;
                case 3:
                    BaseService baseService3= ServicrFatory.getService("xiugai");
                    baseService3.execute();
                    continue;
                case 4:
                    BaseService baseService4= ServicrFatory.getService("quxiao");
                    baseService4.execute();
                    continue;
                case 5:
                    BaseService baseService5= ServicrFatory.getService("lianxiren");
                    baseService5.execute();
                    continue;
                case 6:
                    System.out.println("退出系统");
                    System.out.println("谢谢使用!");
                    System.exit(0);
                default:
                    System.out.println("输入有误,请重新输入!");
                    continue;
            }
        }
    }
}
